import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";

const app = createApp(App);

app.use(router);

app.mount("#app");

function setRemBase() {
  const baseSize = 12; // 基准字体大小
  const designWidth = 1920;
  const html = document.documentElement;
  const clientWidth = Math.max(html.clientWidth, 1400);
  let fontSize = (clientWidth / designWidth) * baseSize;
  fontSize = Math.min(fontSize, 16); // 只比较数字
  html.style.fontSize = fontSize + "px"; // 最后加单位
}

// 初始化
setRemBase();
// 监听窗口变化
window.addEventListener("resize", setRemBase);
